package com.ctshk.sapp.order.scenic.controller;

import com.ctshk.common.annotations.OperationLogAnnotation;
import com.ctshk.common.dto.Result;
import com.ctshk.common.enums.OperationLogModel;
import com.ctshk.common.enums.OperationLogType;
import com.ctshk.rpc.order.scenic.dto.ScenicOrderRefundListDTO;
import com.ctshk.rpc.order.scenic.req.ScenicOrderCollectionReq;
import com.ctshk.rpc.order.scenic.req.ScenicOrderRefundReq;
import com.ctshk.rpc.order.scenic.req.ScenicOrderRefundUpdateReq;
import com.ctshk.rpc.order.scenic.service.IScenicOrderRefundService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.dubbo.config.annotation.DubboReference;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;
import com.ctshk.common.web.support.BaseController;

import java.util.List;

/**
 * <p>
 * 门票退款记录 前端控制器
 * </p>
 *
 * @author 张志朋
 * @since 2021-02-24
 */
@Api(value="门票退款记录", tags="门票退款记录")
@RestController
@RequestMapping("/scenic/order/refund")
public class ScenicOrderRefundController extends BaseController {

    @DubboReference
    private IScenicOrderRefundService iScenicOrderRefundService;

    @ApiOperation(value = "订单中心 - 操作订单退款记录", notes = "订单中心 - 操作订单退款记录(陈雷)")
    @OperationLogAnnotation(operModul = OperationLogModel.TICKET, operType = OperationLogType.QUERY, operTitle = "订单中心 - 操作订单退款记录", operDesc = "订单中心 - 操作订单退款记录")
    @PostMapping(value = "/list")
    public Result<List<ScenicOrderRefundListDTO>> list(@RequestBody ScenicOrderRefundReq scenicOrderRefundReq){
        return iScenicOrderRefundService.list(scenicOrderRefundReq);
    }

    @ApiOperation(value = "订单中心 - 操作订单退款记录 - 操作退款", notes = "订单中心 - 操作订单退款记录 - 操作退款(陈雷)")
    @OperationLogAnnotation(operModul = OperationLogModel.TICKET, operType = OperationLogType.UPDATE, operTitle = "订单中心 - 操作订单退款记录 - 操作退款", operDesc = "订单中心 - 操作订单退款记录 - 操作退款")
    @PostMapping(value = "/refund")
    public Result refund(@RequestBody ScenicOrderRefundUpdateReq scenicOrderRefundUpdateReq){
        return iScenicOrderRefundService.refund(scenicOrderRefundUpdateReq,getCurrentUser(getRequest()));
    }
}
